
export function debounce(fn: () => void, time = 300) {
  let timeout: any = null;
  return function() {
    timeout && clearTimeout(timeout);
    timeout = setTimeout(fn, time);
  };
}
